package com.hqd.ch03.v50.web.context.support;

import com.hqd.ch03.v50.core.env.EnumerablePropertySource;
import com.hqd.ch03.v50.utils.StringUtils;

import javax.servlet.ServletConfig;

public class ServletConfigPropertySource extends EnumerablePropertySource<ServletConfig> {

    public ServletConfigPropertySource(String name, ServletConfig servletConfig) {
        super(name, servletConfig);
    }

    @Override
    public String[] getPropertyNames() {
        return StringUtils.toStringArray(this.source.getInitParameterNames());
    }

    @Override
    public String getProperty(String name) {
        return this.source.getInitParameter(name);
    }

}
